package io.renren.modules.app.controller;


import io.renren.common.utils.R;
import io.renren.modules.app.entity.AnswerEntity;
import io.renren.modules.app.service.BusinessService;
import io.renren.modules.app.service.SubjectCategoryService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/business")
@Api("APP业务接口")
public class AppBusinessController {
    @Autowired
    private BusinessService businessService;

    @Autowired
    private SubjectCategoryService subjectCategoryService;

    @GetMapping("/subjectCategory")
    public R getSubjectCategory() {
        return R.ok().put("subject_category", subjectCategoryService.getSubjectCategory());
    }

    @PostMapping("/subjectResult")
    public R getSubjectResult(@RequestBody List<AnswerEntity> answer) {
        return R.ok().put("subject_result", businessService.getSubjectResult(answer));
    }
}
